// 口味接口管理
import request from "@/utils/request";

import type {
  TasteEditResponse,
  TasteResponse,
  TastesResponse,
  TasteType,
} from "./types";

enum API {
  TASTE_LIST = "/wx/taste/list",
  TASTE_CREATE_OR_EDIT = "/wx/taste/createOrEdit",
  TASTE_GET_BY_ID = "/wx/taste/getById",
  TASTE_REMOVE = "/wx/taste/remove",
}

export const list = () => request.get<any, TastesResponse>(API.TASTE_LIST);

export const tasteCreateOrEdit = (data: TasteType) =>
  request.post<any, TasteEditResponse>(API.TASTE_CREATE_OR_EDIT, data);

export const tasteGetById = (id: number) =>
  request.get<any, TasteResponse>(API.TASTE_GET_BY_ID + `/${id}`);

export const tasteRemove = (id: number) =>
  request.delete<any, TasteEditResponse>(API.TASTE_REMOVE + `/${id}`);
